﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class login : System.Web.UI.Page
{
   protected void Page_Load(object sender, EventArgs e)
   {
      txt_UserID.Focus();
      //Login_SSO.Visible = Functions.IPIsIntranet(Request.UserHostAddress);
   }

   protected void btn_Login_Click(object sender, EventArgs e)
   {
      lbl_LoginError.Visible = false;
      Page.Validate(btn_Login.ValidationGroup);
      if (Page.IsValid)
      {
         string UserName = ddl_Domain.SelectedValue + "\\" + txt_UserID.Text;
         if (Membership.ValidateUser(UserName, txt_Password.Text))
         {
            FormsAuthentication.RedirectFromLoginPage(UserName, cb_RememberMe.Checked);
         }
         else
         {
            lbl_LoginError.Visible = true;
         }
      }
      else
      {
         lbl_LoginError.Visible = true;
      }
      //System.Threading.Thread.Sleep(1000);
   }
}
